package saves.items;

import java.io.Serializable;

public abstract class Item implements Serializable {

    private static final long serialVersionUID = -7312316096243105360L;

    protected String nome, descricao;
    protected float massa, volume, indiceRaridade, indicePreco;
    protected int icone;

    protected Item() {
        this(null, null, -1);
    }
    
    protected Item(String nome) {
        this(nome, null, -1);
    }

    public Item(String nome, String descricao, int icone) {
        this.nome = nome;
        this.descricao = descricao;
        this.icone = icone;
    }

    public String getNome() {
        return nome;
    }

    public String getDescricao() {
        return descricao;
    }

    public int getIcone() {
        return icone;
    }

    public float getMassa() {
        return massa;
    }

    public float getVolume() {
        return volume;
    }
    
    public float getIndicePreco() {
        return indicePreco;
    }
    
    public String getVolumeAndMass() {
        return "Volume: " + volume + " | Mass: " + massa;
    }

    public int getTipo() {
        if (this instanceof Consumivel)
            return 0;
        if (this instanceof Equipamento)
            return 1;
        if (this instanceof Municao)
            return 2;
        if (this instanceof Material)
            return 3;
        if (this instanceof Livro)
            return 4;
        if (this instanceof Chave)
            return 5;
        return 6;
    }
}
